package com.rabbitmq.rabbitmqextensions.listener;

import com.rabbitmq.rabbitmqextensions.constant.Constants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Slf4j
public class DelayListener {

    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void listener(Message message) {
        log.info("接收到消息: {}, time: {}", new String(message.getBody()), new Date());
    }
}
